import noDataIcon from '@/assets/icons/png/nodata.png';

export function noDataOption(myChart: anyObj, title: anyObj) {
	const icon = noDataIcon;
	const msgOption: anyObj = {
		series: [
			{
				type: 'scatter',
				data: [[0, 0]],
				symbolSize: 1,
				label: {
					normal: {
						show: true,
						formatter: title.textStyle.formatter ? '{icon|} ' + title.textStyle.formatter : '{icon|} 暂无数据~',
						borderRadius: 5,
						padding: 10,
						color: '#909399',
						fontSize: 14,
						shadowBlur: 3,
						lineHeight: 30,
						rich: {
							icon: {
								height: 14,
								align: 'center',
								backgroundColor: {
									image: icon,
								},
							},
						},
					},
				},
			},
		],
		xAxis: {
			axisLabel: { show: false },
			axisLine: { show: false },
			splitLine: { show: false },
			axisTick: { show: false },
			min: -1,
			max: 1,
		},
		yAxis: {
			axisLabel: { show: false },
			axisLine: { show: false },
			splitLine: { show: false },
			axisTick: { show: false },
			min: -1,
			max: 1,
		},
	};
	if (title) {
		msgOption.title = title;
	}
	myChart.clear();
	myChart.hideLoading();
	myChart.setOption(msgOption);
}
